package com.zhangxiaofanfan.hotcode.fourth.third;

import java.util.Arrays;

/**
 *
 * @date 2024-07-13 03:14:13
 * @author zhangxiaofanfan
 */
public class HotCode087 {
    public static void main(String[] args) {
        HotCode087 hotCode = new HotCode087();
        int[] nums = {1,3,6,7,9,4,10,5,6};
        System.out.println(hotCode.lengthOfLIS(nums));
    }

    public int lengthOfLIS(int[] nums) {
        if (nums.length == 1) {
            return 1;
        }
        int[] dp = new int[nums.length];
        Arrays.fill(dp, 1);
        int maxLength = 1;
        for (int index = 1, before; index < nums.length; index++) {
            for (before = index - 1; before >= 0; before--) {
                if (nums[index] > nums[before]) {
                    dp[index] = Math.max(dp[before] + 1, dp[index]);
                }
            }
            maxLength = Math.max(maxLength, dp[index]);
        }
        return maxLength;
    }
}